package com.zhiyume.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;


/**
 * 受检查异常异常（编译时异常处理）
 * */
public class AppException extends AppCheckedException{
	private Logger log = LoggerFactory.getLogger(AppException.class);
	private static final long serialVersionUID = 1L;
	private String errId;
	private String msg;
	public String getErrId() {
		return errId;
	}
	public void setErrId(String errId) {
		this.errId = errId;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public AppException(String errId,String msg){
		this.errId = errId;
		this.errId = msg;
		this.writeSysException();
	}
	
	/**
	 * 将异常信息输入到
	 * 
	 * */
	public void writeSysException(){
		log.error("id:"+errId);
	    log.error("msg:"+errId);   
	    ByteArrayOutputStream outPutStream = new ByteArrayOutputStream();
	    PrintStream printStream = new PrintStream(outPutStream);
	    this.printStackTrace(printStream);
	    log.error(outPutStream.toString());
	    
	}

}
